package com.example.lt.entity.user;

import com.example.lt.context.BaseContext;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author 小涛Tao
 * @Date: 2024/08/09/12:17
 * version 1.0 注释：用户模型信息封装类
 **/
@Data
public class UserModel {

    private List<Model> models;

    private Long userId;

    // 根据标签集合、视频id和分数来创建用户模型信息封装对象
    public static UserModel buildUserModel(List<String> labels, Long videoId, Double score) {
        final UserModel userModel = new UserModel();
        userModel.setUserId(BaseContext.get());
        final ArrayList<Model> models = new ArrayList<>();
        for (String label : labels) {
            final Model model = new Model();
            model.setLabel(label);
            model.setVideoId(videoId);
            model.setScore(score);
            models.add(model);
        }
        userModel.setModels(models);
        return userModel;
    }

}
